﻿using Abp.Authorization.Users;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using System.Collections.Generic;

namespace AbpProjectTemplate.Domain.Users.Admins
{
    public class Admin : User
    {
        public const string DefaultPassword = "admin!@#123";

        public static User CreateDefaultAdmin(int? tenantId)
        {
            var adminUser = new Admin
            {
                TenantId = tenantId,
                UserName = AdminUserName,
                Name = AdminUserName,
                Surname = AdminUserName,
                EmailAddress = $"{AdminUserName}@abp.com",
                Roles = new List<UserRole>()
            };

            adminUser.Password = PasswordHasher.HashPassword(adminUser, DefaultPassword);
            adminUser.IsEmailConfirmed = true;
            adminUser.IsActive = true;

            adminUser.SetNormalizedNames();

            return adminUser;
        }
    }
}

